﻿using IOP.Orleans.MessageHub;
using Orleans;
using Orleans.Hosting;

namespace IOP.Orleans.Server.MessageHub
{
    /// <summary>
    /// 消息后台服务扩展
    /// </summary>
    public static class MessageHubServerExtensions
    {
        /// <summary>
        /// 添加消息总线
        /// </summary>
        /// <param name="builder"></param>
        /// <returns></returns>
        public static ISiloHostBuilder AddMessageHub(this ISiloHostBuilder builder)
        {
            builder.ConfigureApplicationParts(config =>
            {
                config.AddApplicationPart(typeof(IMessageHubService).Assembly).WithReferences();
                config.AddApplicationPart(typeof(MessageHubServerExtensions).Assembly).WithReferences();
            });
            return builder;
        }
    }
}
